home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
asmutil
/
asm_n_z.zip
/
PALET2A.ASM
< prev
next >
Wrap
Assembly Source File
|
1988-05-14
|
40KB
|
792 lines
.XLIST
PAGE ,132
TITLE PALET2A.ASM
.LIST
name palet
; Program sets the EGA palette registers from parameters given on the command
; line.
; Release 2 of palette.asm by Charles Lazo III.
; Enhanced, debugged and recompiled by:
; Charles Lazo III [72210,10] and Tim Worley [71336,730]
;
; Detail of changes:
; 'E' switch now traps changes to EGA registers in all display modes
; 'T' switch added to trap changes to EGA registers in text mode only
; 'D' parameter added to return EGA registers to default values
; 'X' switch unchanged (turns off both E and T switches)
; Entire on-screen usage text rewritten.
; Current switch status is displayed each time program is called.
; Switch settings now remain in effect until changed on the command line.
; Release 2a of palette.asm by Lew Paper
;
; Detail of changes:
; 'B' switch now modifies the blink attribute from the starting
; intense background.
; 'B' toggles it from last time palette reset it.
; 'B+' turns on blinking.
; 'B-' turns on intense background colors.
; 'U' switch now modifies underlining from the starting OFF.
; 'U' toggles it from last time palette reset it, underlining at
; the bottom of a character.
; 'U+' turns on underlining at the bottom of a character.
; 'U-' turns off underlining.
; 'U<n>' underlines at row n, where n is decimal. For an 25 line
; display, 0 <= n <= 13. For a 43 line display, 0 <= n <= 8.
; 'F' switch now disables palet. ARCMASTER apparently changes the
; mode of an EGA, and palet's resetting makes it unusable.
; 'N' switch now enables palet again. Use it if you have disabled
; palet with an F switch and want to enable it with no changes.
; Changed octal palette values to decimal.
; All changes are controlled by the variable LP_Version_2A.
LP_Version_2A EQU 1 ; Use Version 3 changes
rt equ 0dh
lf equ 0ah
of equ offset
farr equ dword ptr
IF LP_Version_2A
no_underline_row EQU 1FH ; Underline out of display range
blink_on EQU 1 ; Turn blinking on
blink_off EQU 0 ; Turn intense background on
BIOS_seg segment at 40H
org 63H
addr_6845 label word ; Port to select register for
; CRT controller
org 85H
points label word ; Height of character matrix in lines.
; 25 rows gives points = 14
; 43 rows gives points = 8
; 50 rows gives points = 7
BIOS_seg ends
ENDIF ; LP_Version_2A
code segment
assume cs:code
IF LP_Version_2A
assume ds:nothing, es:nothing
; This line doesn't change the
; original program. In either
; case, all memory references which
; would normally use DS have a CS
; override.
ENDIF ; LP_Version_2A
org 100h
begin: jmp start
key1 dw 0cadeh ; key values stored in code to monitor
key2 dw 0d1bah ; TSR resident status
IF LP_Version_2A
underline_line DB no_underline_row
; Underline row
start_of_EGA_settings EQU (of underline_line)
length_of_EGA_settings EQU ((of old_int_10) - start_of_EGA_settings)
blink_value DB blink_off ; INT 10H BL value for blinking
ENDIF ; LP_Version_2A
set_values db 16 dup(0ffh) ; attribute values to place in palette
; old_int_10 must immediately follow last byte of set_values since its offset
; is used later to detect overflow
old_int_10 dw ?,? ; for segment and offset of old int 10h
our_call db 0 ; flag that lets us only change palette
set_palette proc near
inc es:our_call ; lets our set palette requests go thru
push bx ; save registers used
push cx
IF LP_Version_2A
push dx
ENDIF ; LP_Version_2A
push si
mov cx,16 ; up to 16 palette registers to set
mov si,of set_values; point to new attributes
next_attribute: mov bx,16 ; compute palette register for attribute
sub bx,cx
lodsb ; get attribute to set
cmp al,0ffh ; if ff here, then don't set
jne set_register
loop next_attribute ; set all specified palette registers
jmp short set_done ; done
set_register: mov bh,al ; attribute to bh
mov ax,1000h ; set palette register function
int 10h ; of ROM BIOS video service
loop next_attribute ; set all specified palette registers
IF LP_Version_2A
set_done:
mov bl,blink_value ; Set blinking through BIOS
mov ax,1003H
int 10H
push ds ; Set underlining through direct
; hardware accesses
assume ds:BIOS_seg ; Get address of CRT Controller
mov ax,BIOS_seg
mov ds,ax
mov dx,addr_6845 ; Selector port for CRT Controller
mov al,14h ; Underline register location
out dx,al ; Select underline register
inc dx ; Data port for CRT Controller
assume ds:nothing
pop ds
mov al,underline_line
; location of the underline. Note
; that underline off has 1fh, which
; is usually too big to show
out dx,al
dec es:our_call ; disallow palette register sets
pop si ; restore registers
pop dx
ELSE ; LP_Version_2A
set_done: dec es:our_call ; disallow palette register sets
pop si ; restore registers
ENDIF ; LP_Version_2A
pop cx
pop bx
ret
set_palette endp
graphics db 0 ; =1 if graphics, =0 if text
exclude db 0 ; =1 text & graphx mode changes excluded
txt_exclude db 0 ; =1 text mode changes only excluded
IF LP_Version_2A
palet_off db 0 ; =1 disable palet entirely
ENDIF ; LP_Version_2A
new_int_10 proc far ; routine modifies the int10h interrupt
IF LP_Version_2A
cmp palet_off,1 ; Is palet disabled?
je go_on ; Yes. Bypass it.
ENDIF ; LP_Version_2A
cmp ah,0 ; a mode set request?
je mode_set